package model

import (
	"time"
)

// SeckillVoucher 秒杀优惠券表
type SeckillVoucher struct {
	Id         int64     `gorm:"primaryKey;autoIncrement;comment:主键"`
	VoucherId  string    `gorm:"type:varchar(255);not null;uniqueIndex;comment:优惠券Id"`
	Stock      int       `gorm:"not null;default:0;comment:库存"`
	Amount     float64   `gorm:"type:decimal(10,2);not null;default:0.00;comment:券金额"`
	Title      string    `gorm:"type:varchar(255);not null;default:'';comment:优惠券标题"`
	BeginTime  time.Time `gorm:"not null;comment:抢购开始时间"`
	EndTime    time.Time `gorm:"not null;comment:抢购结束时间"`
	Notified   int8      `gorm:"not null;default:0;comment:是否已推送通知，0：未推送，1：已推送"`
	CreateTime time.Time `gorm:"autoCreateTime;comment:创建时间"`
	UpdateTime time.Time `gorm:"autoUpdateTime;comment:更新时间"`
}

func (SeckillVoucher) TableName() string {
	return "seckill_voucher"
}

// VoucherInfo 优惠券信息响应
type VoucherInfo struct {
	Id        int64   `json:"id"`
	Title     string  `json:"title"`
	Amount    float64 `json:"amount"`
	Stock     int     `json:"stock"`
	BeginTime string  `json:"begin_time"`
	EndTime   string  `json:"end_time"`
}
